package com.fyy.singleton;

/**
 * @Author fyy
 * @Description 单例类
 * @Date 2020/7/17 10:41
 */
public class SingleBean {

    //创建一个私有的对象
    private static SingleBean singleBean = new SingleBean();

    //构造方法私有化，使其不能被实例化
    private SingleBean (){

    }

    //获取唯一可用对象
    public static SingleBean getInstance(){
        return singleBean;
    }

    public void outMessages(){
        System.out.println("hello world");
    }

}
